/*
 * Copyright (C) 2012 Matthias Zeimer and the miniframes community.
 * All rights reserved. 
 * 
 * Licensed under the Eclipse Public License, Version 1.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.opensource.org/licenses/EPL-1.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package de.miniframes.minijpa;

import javax.inject.Provider;

/**
 * <p>
 * Provider of a custom database interface. These interface may but not need to
 * be sub-type of {@link DatabaseInterface}. The interface of specified type T
 * consist only of {@linkplain DatabaseEnquiryMethod database enquiry methods}.
 * </p>
 * 
 * <p>
 * Database interface providers are created with
 * {@link DatabaseInterfaceProviderFactory}.
 * </p>
 * 
 * @param <T>
 *            Type of the interface with {@linkplain DatabaseEnquiryMethod
 *            database enquiry methods}.
 * @author Matthias Zeimer
 * @version 1
 * @since 0.1, 19.06.2012
 * @see DatabaseInterface
 */
public interface DatabaseInterfaceProvider<T> extends Provider<T> {

    /**
     * Provides a fully functional instance of the database interface of type T.
     * Subsequent calls will return the same instance. The result will never be
     * <code>null</code>.
     * 
     * @throws RuntimeException
     *             ... TODO Is that possible? Is there a way to create a
     *             provider with an invalid interface?
     */
    @Override
    public T get() throws RuntimeException;
}
